//
// Created by wze-zero on 2024/9/16 016.
//
#include <iostream>

using namespace std;

int main() {
    int count, num, max = -1, min = 100;
    cin >> count;
    for (int i = 0; i < count; ++i) {
        cin >> num;
        num > max ? max = num : num;
        num < min ? min = num : num;
    }
    num = max - min;
    cout << num << endl;
    return 0;
}